/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "cex_horarios_dia")
@NamedQueries({
    @NamedQuery(name = "CexHorariosDia.findAll", query = "SELECT c FROM CexHorariosDia c")})
public class CexHorariosDia implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "chd_id")
    private Integer chdId;
    @Column(name = "chd_hora_inicio_am")
    @Temporal(TemporalType.TIME)
    private Date chdHoraInicioAm;
    @Column(name = "chd_hora_fin_am")
    @Temporal(TemporalType.TIME)
    private Date chdHoraFinAm;
    @Column(name = "chd_hora_inicio_pm")
    @Temporal(TemporalType.TIME)
    private Date chdHoraInicioPm;
    @Column(name = "chd_hora_fin_pm")
    @Temporal(TemporalType.TIME)
    private Date chdHoraFinPm;
    @Column(name = "chd_num_consultas")
    private Integer chdNumConsultas;
    @Basic(optional = false)
    @Column(name = "chd_intervalo")
    private int chdIntervalo;
    @JoinTable(name = "hos_cambio_turno_horario", joinColumns = {
        @JoinColumn(name = "chd_id", referencedColumnName = "chd_id")}, inverseJoinColumns = {
        @JoinColumn(name = "hct_id", referencedColumnName = "hct_id")})
    @ManyToMany(fetch = FetchType.LAZY)
    private List<HosCambioTurno> hosCambioTurnoList;
    @OneToMany(mappedBy = "cexHorariosDia", fetch = FetchType.LAZY)
    //@OrderBy("cagSecuencia DESC")
    private List<CexAgenda> cexAgendaList;
    @JoinColumn(name = "cho_id", referencedColumnName = "cho_id")
    @ManyToOne(fetch = FetchType.LAZY)
    private CexHorario cexHorario;
    @JoinColumn(name = "cdi_id", referencedColumnName = "cdi_id")
    @ManyToOne(fetch = FetchType.LAZY)
    private CexDia cexDia;
    private transient boolean asignada;
    private transient int ordenHorario;

    public CexHorariosDia() {
    }

    public CexHorariosDia(Integer chdId) {
        this.chdId = chdId;
    }

    public CexHorariosDia(Integer chdId, int chdIntervalo) {
        this.chdId = chdId;
        this.chdIntervalo = chdIntervalo;
    }

    public Integer getChdId() {
        return chdId;
    }

    public void setChdId(Integer chdId) {
        this.chdId = chdId;
    }

    public Date getChdHoraInicioAm() {
        return chdHoraInicioAm;
    }

    public void setChdHoraInicioAm(Date chdHoraInicioAm) {
        this.chdHoraInicioAm = chdHoraInicioAm;
    }

    public Date getChdHoraFinAm() {
        return chdHoraFinAm;
    }

    public void setChdHoraFinAm(Date chdHoraFinAm) {
        this.chdHoraFinAm = chdHoraFinAm;
    }

    public Date getChdHoraInicioPm() {
        return chdHoraInicioPm;
    }

    public void setChdHoraInicioPm(Date chdHoraInicioPm) {
        this.chdHoraInicioPm = chdHoraInicioPm;
    }

    public Date getChdHoraFinPm() {
        return chdHoraFinPm;
    }

    public void setChdHoraFinPm(Date chdHoraFinPm) {
        this.chdHoraFinPm = chdHoraFinPm;
    }

    public Integer getChdNumConsultas() {
        return chdNumConsultas;
    }

    public void setChdNumConsultas(Integer chdNumConsultas) {
        this.chdNumConsultas = chdNumConsultas;
    }

    public int getChdIntervalo() {
        return chdIntervalo;
    }

    public void setChdIntervalo(int chdIntervalo) {
        this.chdIntervalo = chdIntervalo;
    }

    public List<HosCambioTurno> getHosCambioTurnoList() {
        return hosCambioTurnoList;
    }

    public void setHosCambioTurnoList(List<HosCambioTurno> hosCambioTurnoList) {
        this.hosCambioTurnoList = hosCambioTurnoList;
    }

    public List<CexAgenda> getCexAgendaList() {
        return cexAgendaList;
    }

    public void setCexAgendaList(List<CexAgenda> cexAgendaList) {
        this.cexAgendaList = cexAgendaList;
    }

    public CexHorario getCexHorario() {
        return cexHorario;
    }

    public void setCexHorario(CexHorario cexHorario) {
        this.cexHorario = cexHorario;
    }

    public CexDia getCexDia() {
        return cexDia;
    }

    public void setCexDia(CexDia cexDia) {
        this.cexDia = cexDia;
    }

    public boolean isAsignada() {
        return asignada;
    }

    public void setAsignada(boolean asignada) {
        this.asignada = asignada;
    }

    public int getOrdenHorario() {
        return ordenHorario;
    }

    public void setOrdenHorario(int ordenHorario) {
        this.ordenHorario = ordenHorario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (chdId != null ? chdId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CexHorariosDia)) {
            return false;
        }
        CexHorariosDia other = (CexHorariosDia) object;
        if ((this.chdId == null && other.chdId != null) || (this.chdId != null && !this.chdId.equals(other.chdId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "newpackage.CexHorariosDia[ chdId=" + chdId + " ]";
    }

}
